home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / netprog.zip / NETPROG.TAR / ipc / Timing.sh < prev    next >
Text File  |  1989-12-17  |  1KB  |  78 lines

  1.  # (leading space for Xenix /bin/sh)
  2.  
  3. SYS=`systype.sh`
  4.  
  5. case $SYS in
  6. bsd)    LIST="t_pipe t_fifo t_msgq"
  7.     CF="CFLAGS=-O" ;;
  8.  
  9. xenix)    LIST="t_pipe t_fifo t_msgq t_shm"
  10.     CF="CFLAGS=-Me -Ml -O" ;;
  11.  
  12. unixpc)    LIST="t_pipe t_fifo t_msgq t_shm"
  13.     CF="CFLAGS=-O" ;;
  14.  
  15. *)    echo "Unknown system type" ; exit 1 ;;
  16. esac
  17.  
  18. for LEN in 32 128 512 2048
  19. do
  20.     echo
  21.     echo "**********************  LEN = ${LEN}  **********************"
  22.     for i in tim_*.c
  23.     do
  24.         ex $i <<EOF
  25. g/^#define    MESGLEN/s/    [0-9][0-9]*$/    ${LEN}/
  26. x
  27. EOF
  28.     done
  29.     
  30.     eval make "'${CF}'" $LIST
  31.     
  32.     echo " "
  33.     echo "++++++++++ pipe, len = $LEN"
  34.     time t_pipe
  35.     time t_pipe
  36.     time t_pipe
  37.     
  38.     echo " "
  39.     echo "++++++++++ fifo, len = $LEN"
  40.     t_fifoserv &
  41.         sleep 2
  42.     time t_fifocli
  43.     t_fifoserv &
  44.         sleep 2
  45.     time t_fifocli
  46.     t_fifoserv &
  47.         sleep 2
  48.     time t_fifocli
  49.     
  50.     echo " "
  51.     echo "++++++++++ message queue, len = $LEN"
  52.     t_msgqserv &
  53.         sleep 2
  54.     time t_msgqcli
  55.     t_msgqserv &
  56.         sleep 2
  57.     time t_msgqcli
  58.     t_msgqserv &
  59.         sleep 2
  60.     time t_msgqcli
  61.     
  62.     if test -f /usr/include/sys/shm.h
  63.     then
  64.         echo " "
  65.         echo "++++++++++ shared memory, len = $LEN"
  66.         t_shmserv &
  67.             sleep 2
  68.         time t_shmcli
  69.         t_shmserv &
  70.             sleep 2
  71.         time t_shmcli
  72.         t_shmserv &
  73.             sleep 2
  74.         time t_shmcli
  75.     fi
  76. done
  77. exit 0
  78.